package com.neusoft.bd.myspark.spark01

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object M21Join {

  //
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("Operator")
    val sc: SparkContext = new SparkContext(conf)

    val rddl: RDD[(String, Int)] = sc.makeRDD(List(("a", 1), ("a", 2), ("b", 3) ))
    val rddr: RDD[(String, Int)] = sc.makeRDD(List(("b", 4), ("b", 5), ("a", 6)))
//  基本join操作：  (a,(1,6))(a,(2,6))(b,(3,4))(b,(3,5))
    rddl.join(rddr).collect().foreach( print )

  }
}
